/*
package com.yjps.company.service;

import com.yjps.company.dao.RecruitmentDao;
import com.yjps.company.model.Recruitment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * Created by 麒全 on 2015/8/18.
 *//*

@Service
public class RecruitmentService {
    @Autowired
    RecruitmentDao recruitmentDao;

    private static final Logger log = LoggerFactory.getLogger(RecruitmentService.class);

    @Transactional
    public List<Recruitment> getList() {
        String hql = "from Recruitment r where r.valid=1";

        return recruitmentDao.find(hql);
    }

    @Transactional
    public Recruitment find(int id) {
        String hql = "from Recruitment r where r.id = :id";
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        return (Recruitment)recruitmentDao.findUniqueResult(hql, map);

    }

    @Transactional
    public void add(Recruitment r) {
        recruitmentDao.save(r);
    }

    @Transactional
    public boolean update(Recruitment r) {
        Recruitment localRecruitment = recruitmentDao.get(r.getId());
        if (localRecruitment==null || localRecruitment.getIsValid() == 0) {
            return false;
        }
        recruitmentDao.update(r);
        return true;

    }

    @Transactional
    public void delete(Recruitment r) {
        recruitmentDao.invalid(r);
        log.debug("delete the Recruitment success, id is " + r.getId());

    }
}
*/
